﻿<?php
if($_GET['action']=='xoa' && $_GET['pid']){
	if(wp_delete_post($_GET['pid'])) {
		echo '<div id="txtThongBao" style="color:red;">Đã xóa thành công</div>';
	}else{
		echo '<div id="txtThongBao" style="color:red;">Lỗi khi xóa. Vui lòng thử lại</div>';
	}
}
?>
<div class="wrap">
<h2>Bài viết:<a href="./admin.php?page=Dang_bai" class="add-new-h2">Đăng bài</a></h2>



<form id="posts-filter" action="" method="get">

<p class="search-box">
	<label class="screen-reader-text" for="post-search-input">Tìm bài viết:</label>
	<input type="search" id="post-search-input" name="s" value="">
	<input type="submit" name="" id="search-submit" class="button" value="Tìm bài viết"></p>
<table class="wp-list-table widefat fixed posts" cellspacing="0">
	<thead>
	<tr>
		<th scope="col" id="cb" class="manage-column column-cb check-column" style=""><label class="screen-reader-text" for="cb-select-all-1">Select All</label><input id="cb-select-all-1" type="checkbox"></th><th scope="col" id="title" class="manage-column column-title sortable desc" style=""><a href="http://ttcn.me/wp-admin/edit.php?orderby=title&amp;order=asc"><span>Tiêu đề</span><span class="sorting-indicator"></span></a></th><th scope="col" id="author" class="manage-column column-author" style="">Người đăng</th><th scope="col" id="categories" class="manage-column column-categories" style="">Mục</th><th scope="col" id="tags" class="manage-column column-tags" style="">Thẻ</th><th scope="col" id="comments" class="manage-column column-comments num sortable desc" style=""><a href="http://ttcn.me/wp-admin/edit.php?orderby=comment_count&amp;order=asc"><span><span class="vers"><div title="Bình luận" class="comment-grey-bubble"></div></span></span><span class="sorting-indicator"></span></a></th><th scope="col" id="date" class="manage-column column-date sortable asc" style=""><a href="http://ttcn.me/wp-admin/edit.php?orderby=date&amp;order=desc"><span>Ngày đăng</span><span class="sorting-indicator"></span></a></th>	</tr>
	</thead>

	

	<tbody id="the-list">
	<?php 
	$args = '&orderby=date&order=DESC';
	// run the query
	query_posts( $args );
	while(have_posts()) : the_post(); ?>
		<tr id="post-<?php the_ID(); ?>" class="post-<?php the_ID(); ?> type-post status-publish format-standard hentry category-nhat-ky alternate iedit author-self level-0" valign="top">
				<th scope="row" class="check-column">
				<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"></label>
				<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>">
				<div class="locked-indicator"></div>
							</th>
				<td class="post-title page-title column-title"><strong><a class="row-title" href="http://ttcn.me/wp-admin/post.php?post=<?php the_ID(); ?>&amp;action=edit" title="Sửa <?php the_title(); ?>"><?php the_title(); ?></a></strong>
					<div class="locked-info"><span class="locked-avatar"></span> <span class="locked-text"></span></div>
					<div class="row-actions">
						<span class="edit"><a href="./admin.php?page=Dang_bai&pid=<?php the_ID(); ?>&action=edit" title="Sửa bài">Sửa</a> | </span>
						<span class="trash"><a class="submitdelete" title="Xóa bài viết" href="./admin.php?page=Quan_ly_bai_viet&pid=<?php the_ID(); ?>&action=xoa">Xóa</a> | </span>
						<span class="view"><a href="<?php the_permalink(); ?>" title="Xem bài viết" rel="permalink">Xem</a></span>
					</div>					
				</td>			
				<td class="author column-author"><a href="edit.php?post_type=post&amp;author=1">ttcn</a></td>
				<td class="categories column-categories">
					<a href="edit.php?category_name=nhat-ky"><?php the_category(); ?></a>
				</td>
				<td class="tags column-tags">--</td>			
				<td class="comments column-comments"><div class="post-com-count-wrapper">
				<a href="http://ttcn.me/wp-admin/edit-comments.php?p=<?php the_ID(); ?>" title="0 pending" class="post-com-count"><span class="comment-count">0</span></a></div></td>
				<td class="date column-date"><abbr title="<?php the_time('F j, Y'); ?>"><?php the_time('g:i a'); ?></abbr></td>		
		</tr>
	<?php endwhile; ?>
	</tbody>
</table>
</form>
<div id="ajax-response"></div>
<br class="clear">
</div>